<?php

namespace App\Admin\Controllers\Topic;

use App\Models\Topic\Topic;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;

class TopicsController extends AdminController
{
    /**
     * Title for current resource.
     *
     * @var string
     */
    protected $title = '话题';

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        $grid = new Grid(new Topic());

        $grid->column('id', __('Id'));
        $grid->column('category.name', __('分类'));
        $grid->column('title', __('标题'));
        $grid->column('body', __('内容'));
        $grid->column('reply_count', __('回复数量'));
        $grid->column('view_count', __('查看数量'));
        $grid->column('slug', __('SEO'));
        $grid->column('user.name', __('发布人'));
        $grid->column('status', __('状态'));
        $grid->column('created_at', __('时间'));
        // 不在页面显示 `新建` 按钮，因为我们不需要在后台新建用户
        $grid->disableCreateButton();
        // 同时在每一行也不显示 `编辑` 按钮
        $grid->disableActions();

        return $grid;
    }


}
